From: Jiaxun Yang Date: Fri, 2 Feb 2024 12:30:28 +0000 (+0000) Subject: mm/memory: Use exception ip to search exception tables X-Git-Tag: archive/raspbian/6.1.129-1+rpi1^2~59 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=d10a882222d08f1632c8dda95ea4d1d2bceedbc4;p=linux.git mm/memory: Use exception ip to search exception tables Origin: https://git.kernel.org/linus/8fa5070833886268e4fb646daaca99f725b378e9 Bug-Debian: https://bugs.debian.org/1093200 Bug-Debian: https://bugs.debian.org/1087809 Bug-Debian: https://bugs.debian.org/1086028 On architectures with delay slot, instruction_pointer() may differ from where exception was triggered. Use exception_ip we just introduced to search exception tables to get rid of the problem. Fixes: 4bce37a68ff8 ("mips/mm: Convert to using lock_mm_and_find_vma()") Reported-by: Xi Ruoyao Link: https://lore.kernel.org/r/75e9fd7b08562ad9b456a5bdaacb7cc220311cc9.camel@xry111.site/ Suggested-by: Linus Torvalds Signed-off-by: Jiaxun Yang Signed-off-by: Thomas Bogendoerfer Gbp-Pq: Topic bugfix/all Gbp-Pq: Name mm-memory-Use-exception-ip-to-search-exception-table.patch --- diff --git a/mm/memory.c b/mm/memory.c index e74234449f4..f79fe69ead4 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5324,7 +5324,7 @@ static inline bool get_mmap_lock_carefully(struct mm_struct *mm, struct pt_regs } if (regs && !user_mode(regs)) { - unsigned long ip = instruction_pointer(regs); + unsigned long ip = exception_ip(regs); if (!search_exception_tables(ip)) return false; } @@ -5349,7 +5349,7 @@ static inline bool upgrade_mmap_lock_carefully(struct mm_struct *mm, struct pt_r { mmap_read_unlock(mm); if (regs && !user_mode(regs)) { - unsigned long ip = instruction_pointer(regs); + unsigned long ip = exception_ip(regs); if (!search_exception_tables(ip)) return false; }